﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ChartSharp
{
    public class LineStyles : ChartParam
    {
        protected IEnumerable<LineStyle> _styles;

        public override string Name
        {
            get { return "chls"; }
        }

        public override string Data
        {
            get
            {
                StringBuilder builder = new StringBuilder();

                if (_styles != null)
                {
                    _styles.ToList().ForEach((style) =>
                    {
                        builder.Append(style);
                        builder.Append("|");
                    });

                    if (builder.Length > 0)
                    {
                        builder.Length--;
                    }
                }

                return builder.ToString();
            }
        }

        public LineStyles(LineStyle style)
        {
            _styles = new LineStyle[] { style };
        }

        public LineStyles(IEnumerable<LineStyle> styles)
        {
            _styles = styles;
        }
    }
}
